package cn.jinbyte.starter.captcha.model;

import com.wf.captcha.base.Captcha;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;


/**
 * 验证码
 */
@Accessors(chain = true)
public class ImgCaptcha extends AbstractCaptcha {
    /**
     * 验证码图片
     */
    @Getter
    @Setter
    private String img;

    public static ImgCaptcha of(Captcha captcha) {
        ImgCaptcha imgCaptcha = new ImgCaptcha();
        imgCaptcha.code = captcha.text();
        imgCaptcha.img = captcha.toBase64();
        return imgCaptcha;
    }
}
